	//동호회 쪽지정보
	function clsClubAdminLetter_List(){
		this.listData = null;
		this.totalCount = null;
		this._HTMDom = null;
		this._init();
	}
	
	clsClubAdminLetter_List.prototype = {
		_init: function(){
			var $layer = $("section#club_admin_letter>section>ul.club_letter_list");
			this._HTMLDom = {
				"$layer": $layer
				, "$element" : $layer.find(">li:first")
			}
			$layer.empty();
		}
		, setList: function(thisData){
			if(!this.listData){
				this.listData = [];
			}
			this.push(thisData);
		}
		, push: function(thisData){
			var $element = this._HTMLDom["$element"];
			var $tmp = [];
			
			for(var i=0;i<thisData.length;i++){
				$tmp.push($element.clone(true));
				$tmp[i].find("div.date").html(thisData[i]["발송일"]);
				$tmp[i].find("div.admin").html(thisData[i]["발송자"]);
				$tmp[i].find("div.grade").html(thisData[i]["수신등급"]);
				$tmp[i].find("div.sub").html(thisData[i]["쪽지내용"]);
				this.listData.push(thisData[i]);
			}
			
			this.display($tmp);
		}
		, display: function(thisData){
			var $layer = this._HTMLDom["$layer"];
			
			for(var i=0;i<thisData.length;i++){
				$layer.append(thisData[i]);
			}

			if(this.listData.length == this.totalCount){
				this.$getMore().hide();
			}
		}
		, $getLayer: function(){
			return $("section#club_admin_letter");
		}
		, $getMore: function(){
			return $("section#club_admin_letter div.btn_area div.btn_more");
		}
	}
	
	//데이터연동		
	function clsComm_ClubAdminLetter(){
		this.adminLetterList = null;
		this.searchRequet = null;
		this.listData = null;
		this._init();
	}	
	clsComm_ClubAdminLetter.prototype = {
		_init: function(){
			this.searchRequest = {
				"페이지": null
				, "총갯수": null
			}
		}
		, getClubAdminLetter: function(){
			var thisClass = this;
			var objJson = new MJson();
			var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
			objJson.putPub(MJson.PUB.SID, "CL001");
			objJson.putPub(MJson.PUB.SERVICENAME, "getSentMessageList");
			objJson.putPub(MJson.PUB.LISTCOUNT, 10);
			objJson.putPub(MJson.PUB.CURRPAGENO, this.getSearchRequest("페이지"));
			
			objJson.putParameter("clubSeq", _gf.CLUB_DATA["동호회키"]);
						
			cm.requestGet(objJson.getJsonString(), function($jsonData){
				
				var res = $jsonData["msp"]["contents"]["items"];
				thisClass.setSearchRequest("총갯수", $jsonData["msp"]["contents"]["@totalcount"]);
				thisClass.adminLetterList = [];
				if(res){
					if(!res.length){
						res = new Array(res);	
					}
					
					for(var i=0;i<res.length;++i){
						var obj = res[i];
							thisClass.adminLetterList.push({
								"동호회키": _util.nvl(obj["clubSeq"])
								, "쪽지키": _util.nvl(obj["messageOutSeq"])
								, "발송일": _util.nvl(obj["sendDate"])
								, "발송시간": _util.nvl(obj["sendTime"])
								, "발송자": _util.nvl(obj["senderUserInfo"]["userId"])
								, "수신등급": _util.nvl(obj["targetMemberRoleName"])
								, "쪽지내용": _util.nvl(obj["messageOut"]["messageBody"])
							});
					}
				}
				$(thisClass).trigger("evtFinishClubLetterAgree");
			}, function($err) {
				alert($err);
			});
		}
		, getClubAdminLetterData: function(){
			return this.adminLetterList;
		}
		, setSearchRequest: function(key, val){
			this.searchRequest[key] = val;
		}
		, getSearchRequest: function(key){
			return this.searchRequest[key];
		}
		
	}
	
	//컨트롤파일
	function ClubAdminLetter(){
		this.club_seq = null;
		
		this.club_info = null;		
		this.objComm = null;
		this.objClubAdminLetter_List = null;
	};
	
	ClubAdminLetter.prototype = {
		onPageShow : function() {
			$("a").attr("href", "").attr("data-rel", "");
	    	
			this._init();
		}
		, _beforeStart: function(){
	    	var 	thisClass = this;
	    	
	    	this._permitStart = {
				"동호회정보": false	
			}
			
	  		// 서버 메시지맵
			$.ajax({
				url: "../js/src/club/club_inc.js"
				, type: "get"
				, dataType: "script"
				, async: false
				, success: function(ret, sta){
					//alert("success!!");					
				}
				, error:function(e){
					//alert("error=" + e);
				}	
			});
			
			_cb.getClubInfoData({
				"콜백": function(ret, l){
					thisClass._permitStart["동호회정보"] = true;	
				}
			});
			
			_util.executeThread(function(){
				for(key in thisClass._permitStart){		
					if(!thisClass._permitStart[key]) return false;
				}
				return (true);
			}, function(){			
				thisClass._start();
			});
	   }
		, _init: function(){
			this.objComm = new clsComm_ClubAdminLetter();
			this.objClubAdminLetter_List = new clsClubAdminLetter_List();
			
			this._beforeStart();
			
			this.getParam();
	    	
			this._bind();			
		}
		, _start: function(){
			this.club_info = _cb.getClubInfo();
		   
		   this._role();
		   
		   //쪽지목록 조회
			this.spinStart();
			this.objComm.setSearchRequest("페이지", 1);
			this.objComm.getClubAdminLetter();
		}
		, _bind: function(){
			var thisClass = this;
			
			//조회완료
			$(this.objComm).bind("evtFinishClubLetterAgree", function(event){
				var listData = thisClass.objComm.getClubAdminLetterData();
				thisClass.objClubAdminLetter_List.totalCount = thisClass.objComm.getSearchRequest("총갯수");
				thisClass.objClubAdminLetter_List.setList(listData);
				thisClass.spinEnd();
			});
			
			//동호회정보 화면으로 이동
			this.objClubAdminLetter_List.$getLayer().find("footer ul li:eq(0) a").click(function(event){
				$.mobile.changePage("club_control.html", "slide", true);
			});
			
			//동호회정보 화면으로 이동
			this.objClubAdminLetter_List.$getLayer().find("footer ul li:eq(1) a").click(function(event){
				$.mobile.changePage("club_agree.html", "slide", true);
			});
			
			//동호회 쪽지 화면으로 이동
			this.objClubAdminLetter_List.$getLayer().find("footer ul li:eq(2) a").click(function(event){
				$.mobile.changePage("club_letter.html", "slide", true);
			});
			
			//더보기 버튼 이벤트
			this.objClubAdminLetter_List.$getMore().find("button").click(function(event){
				thisClass.spinStart();
				thisClass.objComm.setSearchRequest("페이지", (thisClass.objComm.getSearchRequest("페이지")+1));
				thisClass.objComm.getClubAdminLetter();
			});
			
			//상세보기 버튼 이벤트
			this.objClubAdminLetter_List.$getLayer().find("section>ul.club_letter_list").on("click", " li", function(event){
				var idx = thisClass.objClubAdminLetter_List.$getLayer().find("section>ul.club_letter_list>li").index($(this));
				var seq = thisClass.objClubAdminLetter_List.listData[idx]["쪽지키"];
				_gf.CLUB_DATA["쪽지키"] = seq;
				$.mobile.changePage("club_letter_view.html", "slide", true);
			});
			
			//글쓰기 버튼 이벤트
			this.objClubAdminLetter_List.$getLayer().find("section div.club_letter_txt p.bt a").click(function(event){
				$.mobile.changePage("club_letter_write.html", "slide", true);
			});
			
			//메뉴
		 	$("section#club_admin_letter nav ul li a:eq(0)").click(function(event){
		 		event.preventDefault();
		 		thisClass.goNavi();
		 	});
		 	
		 	//알림
		 	$("section#club_admin_letter nav ul li:eq(1)").click(function(event){
		 		event.preventDefault();
		 		$.mobile.changePage("../inc/info_booking.html","slide",true);	
		 	});
		 	
		 	//이전
		 	$("section#club_admin_letter header div.top_title_G div.top_left a.btn2").click(function(event){
		 		event.preventDefault();
		 		_gf.CLUB_DATA = {
					"동호회키": thisClass.club_seq	
				}
		 		$.mobile.changePage("self_club.html","slide",true);	
		 	});
		}
		, getParam: function(){
			this.club_seq = _gf.CLUB_DATA["동호회키"];
		}
		, _role: function(){
			if(!this.club_info.isMember()){
    			alert(this.club_info.getError());
    			_gf.CLUB_DATA = {
    				"동호회키": this.club_seq	
    			}
    			$.mobile.changePage("self_club.html","slide",true);
    			return;
    		}else if(!this.club_info.isAdmin()){
    			alert(this.club_info.getError());
    			_gf.CLUB_DATA = {
    				"동호회키": this.club_seq	
    			}
    			$.mobile.changePage("self_club.html","slide",true);
    			return;	
    		}
		}
		, goNavi: function(){			
			$.mobile.changePage("../inc/navi.html","slide",true);
		}
	  , spinStart: function(){		
			$.mobile.showPageLoadingMsg();			
		}
		, spinEnd: function(){			
			$.mobile.hidePageLoadingMsg();				
		}
	}	